#!/usr/bin/env python3
# coding: utf-8
# Copyright (c) 2025 Huawei Technologies Co., Ltd.
# This file is a part of the CANN Open Software.
# Licensed under CANN Open Software License Agreement Version 1.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.
# ======================================================================================================================

api: pytorch
api_type: function_aclnn_moe_init_routing_V2
version: v2.1
name: aclnn_moe_init_routing_v2
aclnn_name: MoeInitRoutingV2
dtype_numbers: 208
extra_numbers: 0
generate: ascend_generate_aclnn_moe_init_routing_v2
standard:
  acc: default
inputs:
  - name: x
    type: tensor
    required: true
    dtypes:
      values: [ fp16 ]
    ranges:
      valid:
        values: [ [-100, 100] ]
      invalid:
        values: [[-100, 100]]
    shapes:
      dim_numbers:
        values: [ 2 ]
      dim_values:
        values: [ [32,64] ] 

  - name: expert_idx
    type: tensor
    required: true
    dtypes:
      values: [ int32 ]
    ranges:
      valid:
        values: [[1, 2]]
      invalid:
        values: [[1, 2]]
    shapes:
      dim_numbers:
        values: [  2 ]
      dim_values:
        values: [ 1, 7, 8, 9, 15, 16, 17, 19, 20, 21, 255, 256, 257,[4096,7168]]

  - name: active_num
    type: attr
    required: true
    dtypes:
      values: [ int ]
    ranges:
      valid:
        values: [ [1, 256] ]
      invalid:
        values: [ [1, 256] ]

  - name: expert_capacity
    type: attr
    required: true
    dtypes:
      values: [ int ]
    ranges:
      valid:
        values: [ [1, 8] ]
      invalid:
        values: [ [1, 8] ]

  - name: expert_num
    type: attr
    required: true
    dtypes:
      values: [ int ]
    ranges:
      valid:
        values: [ [220, 400] ]
      invalid:
        values: [ [220, 400]  ]
    
  - name: drop_pad_mode
    type: attr
    required: true
    dtypes:
      values: [ int ]
    ranges:
      valid:
        values: [ 1 ]
      invalid:
        values: [ 1 ]
    
  - name: expert_tokens_count_or_cumsum_flag
    type: attr
    required: true
    dtypes:
      values: [ int ]
    ranges:
      valid:
        values: [ 2 ]
      invalid:
        values: [ 2 ]

  - name: expert_tokens_before_capacity_flag
    type: attr
    required: true
    dtypes:
      values: [ bool ]
    ranges:
      valid:
        values: [ true ]
      invalid:
        values: [ true ]